﻿<?php ob_start();
require_once('./Connections/microassur.php'); 
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
	function today()
	{
		$jour = array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
		$mois = array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");
		echo @$jour[date(w)]." ".@date(j)." ".@$mois[date(n)-1]." ".@date(Y);
	}
	function isHabilitation($hab,$database_microassur, $microassur,$username_microassur, $password_microassur)
	{
	  	$colname_rs = -1;
			if (isset($_SESSION['MM_UserGroup']) && $_SESSION['MM_UserGroup']!=NULL)
				$colname_rs = intval($_SESSION['MM_UserGroup']);
			else
				$colname_rs = 0;
		$query_rs1 = sprintf("SELECT * FROM habilitation WHERE Identifiant_profil = %s", GetSQLValueString($colname_rs, "int"));
		$rs = mysql_query($query_rs1, $microassur) or die(mysql_error());
		$row_rs = mysql_fetch_assoc($rs);
		$totalRows_rs = mysql_num_rows($rs);
		$hab = strtoupper(substr($hab, 0,5)); 
		$code_even="";
		$n=0;
		$i=0;
		do
		{
			$code_even=strtoupper($row_rs['Code_evenement']);
			if($code_even==$hab){ $n+=1; $_SESSION["$hab"]=$hab; $i++; }
		} while ($row_rs = mysql_fetch_assoc($rs)); 
		
		if($n==0) return 'none' ; 
	}
?>